home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-21 | 4.7 KB | 195 lines | [TEXT/CWIE] |
- //===================================================================
- //======================= Headers =============================
-
- #include "DifferenceCloud.h"
- #include "GameUtilities.h"
- #include "Screen.h"
-
- //===================================================================
- //======================= Globals =============================
-
-
- //===================================================================
- //======================= #define =============================
-
-
- //===================================================================
- //======================= Function Prototypes =====================
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: Constructor
-
- \----------------------------------------------------------------------------*/
- DifferenceCloud :: DifferenceCloud( void )
- : Window()
- {
-
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: Init
-
- \----------------------------------------------------------------------------*/
- Boolean DifferenceCloud :: Init( void )
- {
- width = 695;
- height = 711;
- if( window.NewBuff( width , height ) )
- {
- OffScreenBuff backGround;
-
- backGround.LoadPicBuff( 140 );
-
- DrawPicture( &backGround , &backGround.GetBoundsSize(),
- &window , &window.GetBoundsSize() );
-
- screenLoc.left = 80;
- screenLoc.top = 22;
- screenLoc.right = screenLoc.left + width;
- screenLoc.bottom = screenLoc.top + height;
-
- return true;
- }
-
- return false;
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: HandleMouseClick
-
- \----------------------------------------------------------------------------*/
- void DifferenceCloud :: HandleMouseClick( Boolean down , point where )
- {
- if( down )
- {
- draging = true;
- start = where;
-
- where.x -= screenLoc.left;
- where.y -= screenLoc.left;
-
- }
- else
- {
-
- if( draging )
- {
- screen.AddRectToUpdate( screenLoc );
-
- MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
-
- screen.AddRectToUpdate( screenLoc );
-
- draging = false;
- }
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: HandleMouseMove
-
- \----------------------------------------------------------------------------*/
- void DifferenceCloud :: HandleMouseMove( point where )
- {
- if( draging )
- {
- screen.AddRectToUpdate( screenLoc );
-
- MyOffSetRect( &screenLoc , where.x - start.x , where.y - start.y );
- start = where;
-
- screen.AddRectToUpdate( screenLoc );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: PointInWindow
-
- - just saids if the point it inside the window area or not
- \----------------------------------------------------------------------------*/
- Boolean DifferenceCloud :: PointInWindow( point where )
- {
- return SectPtRect( where , screenLoc );
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: Active
-
- \----------------------------------------------------------------------------*/
- Boolean DifferenceCloud :: Front( void )
- {
- return( front );
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: SetFront
-
- \----------------------------------------------------------------------------*/
- void DifferenceCloud :: SetFront( Boolean f )
- {
- if( f != front )
- {
- front = f;
- screen.AddRectToUpdate( screenLoc );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: DrawToScreen
-
- \----------------------------------------------------------------------------*/
- void DifferenceCloud :: DrawToScreen( rect *where , Boolean backGround )
- {
- if( front && !backGround )
- {
- if( where == NULL )
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- NULL , 0 , 0 , 0 );
- }
- else
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- where , 0 , 0 , 0 );
- }
- }
- else
- {
- if( where == NULL )
- {
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- NULL , kDrawTint , 16 , 0xffff );
- }
- else
- screen.DrawGeneric( &window , &window.GetBoundsSize() , &screenLoc ,
- where , kDrawTint , 16 , 0xffff );
- }
- }
-
- /*----------------------------------------------------------------------------\
-
- DifferenceCloud :: DoJunk
-
- \----------------------------------------------------------------------------*/
- void DifferenceCloud :: DoJunk( void )
- {
- OffScreenBuff backGround;
- rect where;
-
- MySetRect( &where , 6 , 22 , 673 , 688 );
-
- backGround.LoadPicBuff( 141 );
-
- DrawPicture( &backGround , &backGround.GetBoundsSize(),
- &window , &where );
-
- screen.AddRectToUpdate( screenLoc );
- }